from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class edit_menu_fake :
    def __init__ ( self ) :
        self . _show_edit_menu = False
        self . _hide_edit_menu = False
        self . _on_key_escape = False
        self . _key_escape_counter_reply = None
    def show_edit_menu ( self ) :
        self . _show_edit_menu = True
    def hide_edit_menu ( self ) :
        self . _hide_edit_menu = True
    def on_key_escape ( self ) :
        self . _on_key_escape = True
    def key_escape_counter_reply ( self , counter ) :
        self . _key_escape_counter_reply = counter

class arbitrary_module_fake :
    def show_edit_menu ( self ) :
        pass
    def hide_edit_menu ( self ) :
        pass
    def on_key_escape ( self ) :
        pass
    def key_escape_counter_reply ( self , counter ) :
        pass

class mediator_edit_menu_tests : 
    'mediator_edit_menu'
    def __init__ ( self , test ) :
        self . _test = test
        self . _edit_menu = edit_menu_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'edit_menu' 
            , self . _edit_menu
            , arbitrary_module_fake
            ) )
    def test_show_edit_menu ( self ) :
        self . _mediator . show_edit_menu ( )
        self . _test . assume_true ( self . _edit_menu . _show_edit_menu )
    def test_hide_edit_menu ( self ) :
        self . _mediator . hide_edit_menu ( )
        self . _test . assume_true ( self . _edit_menu . _hide_edit_menu )
    def test_on_key_escape ( self ) :
        self . _mediator . on_key_escape ( )
        self . _test . assume_true ( self . _edit_menu . _on_key_escape )
    def test_key_escape_counter_reply ( self ) :
        self . _mediator . key_escape_counter_reply ( 'my counter' )
        self . _test . assume_equal ( self . _edit_menu . _key_escape_counter_reply , 'my counter' )
